#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
    int N, cut = 0;
    int i;
    scanf("%d", &N);
    if (N <= 2000 || N > 2100)
    {
        printf("Invalid year!\n");
        return 0;
    }
    if (2000 < N && N <= 2100)
    {
        for (i = 2004; i <= N; i+=4)
        {
            if (i % 4 == 0 && i % 100 != 0)
            {
                printf("%d\n", i);
                cut++;
            }
            else if (i % 400 == 0)
            {
                printf("%d\n", i);
                cut++;
            }
        }
        if (cut == 0)
            printf("None");
    }
}